<#import "_master.ftl" as layout />

<@layout.masterTemplate
title="Edifici">


<section id="model">
	<div class="page-header">
		<h1>
			Edifici
			<button class="btn" type="button" style="float:right" id="create-new">
				<i class=" icon-plus"></i>
				Crea nuovo edificio
			</button>
		</h1>
	</div>

	<@layout.alert type="success" title="Bene!" message="Il nuovo edificio
	è stato creato con successo." />
	<@layout.alert type="error" title="Oooopppps!" message="Qualcosa è andato storto." />

	<form class="bs-docs form-horizontal" style="display:none" id="form-new"
		method="post">
		<button type="button" class="close" title="chiudi">×</button>
		<legend>Crea nuovo edificio</legend>
		<div class="control-group">
			<label class="control-label" for="nome">Contatto</label>
			<div class="controls controls-row">
				<input class="span3" type="text" id="nome" name="nome" placeholder="Nome" />
			</div>
			<div class="controls controls-row">
				<input class="span3" type="text" name="cognome" placeholder="Cognome" />
			</div>
			<div class="controls controls-row">
				<input class="span3" type="text" name="telefono" placeholder="+41 79 999 99 99" />
			</div>
		</div>
		<div class="control-group">
			<label class="control-label" for="via">Indirizzo</label>
			<div class="controls controls-row">
				<input class="span3" type="text" id="via" name="via" placeholder="Via" />
			</div>
			<div class="controls controls-row">
				<input class="span1" maxlength="4" type="number" name="nap" placeholder="NAP" />
			</div>
			<div class="controls controls-row">
				<input class="span3" type="text" name="localita" placeholder="Località" />
			</div>
			<div class="controls controls-row">
				<input class="span3" type="text" name="nazione" placeholder="Nazione" />
			</div>
		</div>
		<div class="control-group">
			<div class="controls">
				<button type="submit" class="btn btn-primary" id="submit-new">Crea
				</button>
			</div>
		</div>
	</form>

	<table class="table table-striped" id="list">
		<#if (edifici?size > 0)>
		<thead>
			<tr>
				<th>#</th>
				<th>Contatto</th>
				<th>Indirizzo</th>
				<th>Azioni</th>
			</tr>
		</thead>
		<tbody>

			<#list edifici as edificio>
			<tr>
				<td>${edificio.id?string.computer}</td>
				<td>${edificio.contatto?string}</td>
				<td>${edificio.indirizzo?string}</td>
				<td><a href="/Edificio?id=${edificio.id?string.computer}" class="icon-eye-open" title="vedi dettagli" style="cursor:pointer"></a></td>
			</tr>
			</#list>
		</tbody>
		<#else>
		<tbody>
			<tr>
				<td colspan="3">Nessun edificio trovato</td>
			</tr>
		</tbody>
		</#if>
	</table>
</section>



</@layout.masterTemplate>